<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page  import="java.util.*"%>
<%@ page  import="edu.lhh.model.newstype"  %>    
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
 <link href="css/bootstrap.css" rel="stylesheet" media="screen">
  <link href="js/jquery-2.2.4.min.js" rel="stylesheet" media="screen">
<script src="js/jquery-2.2.4.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<title>Insert title here</title>
</head>
<body>
<!-- 搜索 -->
<form action="./search" method="get" class="form-inline" role="form">
   <div class="form-group">
      <input type="text" class="form-control" name="name" placeholder="输入学号或姓名" required>
   </div>
   <button type="submit" class="btn btn-default">搜索</button>
</form>
<!-- 搜索 -->


<div class = "container">
		<div class="row">
			<div class = "col-xs-10"></div>
			<div class = "col-xs-2">
<!-- 添加学生信息  -->
<button class="btn btn-info btn-lg btn-block" data-toggle="modal" data-target="#myModal">
添加学生
</button>
<form action = "./newstype" method="post" >
<input type="hidden" name="opt" value="add">
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="myModalLabel">
学生信息
</h4>
</div>
<div class="modal-body">
学号<input type="text" name="id" class="form-control" onkeyup="this.value=this.value.replace(/[^\d]/g,'')" required><br>
姓名<input type="text" name="name" class="form-control" onkeyup="this.value=this.value.replace(/[^\u4e00-\u9fa5]/g,'')" required><br>
性别<input type="text" name="sex" class="form-control" onkeyup="this.value=this.value.replace(/[^\u4e00-\u9fa5]/g,'')" required><br>
旷课数<input type="text" name="age" class="form-control" onkeyup="this.value=this.value.replace(/[^\d]/g,'')" required><br>
</div>
<div class="modal-footer">
<input type="submit" value="保存" class="btn btn-default">
</div>
</div>
</div>
</div>
</form>
<!--  <div><a href="./newstype?opt=add">添加</a></div>  -->
<!-- 添加学生信息  --></div>
		</div>
	</div>






	<table  class="table table-hover" >
	<thead>
	<tr >
		<th>学号</th>
		<th>姓名</th>
		<th>性别</th>
		<th>旷课数</th>
		<th>操作</th>
	</tr>
	</thead>
	<%
	Object obj = request.getAttribute("types");
	if (obj != null){
		List<newstype> lst = (List<newstype>)obj;
		Iterator it = lst.iterator();
		while (it.hasNext()){
			newstype type = (newstype)it.next();
			%>
		<tbody>
		<tr>
			<td><%=type.getId() %></td>
			<td><%=type.getName() %></td>
			<td><%=type.getSex() %></td>
			<td><%=type.getAge() %></td>
			<td><a href="./newstype?opt=del&index=<%=type.getIndex()%>">删除</a>&nbsp;<a href="./newstype?opt=updata&index=<%=type.getIndex()%>">修改</a></td>
		
		</tr>
		</tbody>
		<%
		}				
	}	
	%>

	</table>
</body>
</html>